package StudyCode.summary.mydatetime;

import java.time.LocalDateTime;
import java.time.ZoneId;
import java.time.ZoneOffset;
import java.time.ZonedDateTime;
import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
import java.util.Set;

/**
 * 版权所有 科技与人文(www.tah1986.com)
 */
public class OneHourTimeZoneId {
	public static void main(String[] args) {
		Set<String> allZones = ZoneId.getAvailableZoneIds();
		List<String> zoneList = new ArrayList<>(allZones);
		Collections.sort(zoneList);
		LocalDateTime dt = LocalDateTime.now();

		for (String s : zoneList) {
			ZoneId zone = ZoneId.of(s);
			ZonedDateTime zdt = dt.atZone(zone);
			ZoneOffset offset = zdt.getOffset();
			int secondsOfHour = offset.getTotalSeconds() % (60 * 60);
			String out = String.format("%35s %10s%n", zone, offset);
			if (secondsOfHour != 0) {
				System.out.printf(out);
			}
		}

	}
}
